#pragma once

#ifndef JI_UTIL_CONFIGURATION
#define JI_UTIL_CONFIGURATION
#include "json/json.h"
#include <unistd.h>
#include <stdio.h>
#define ACC(x)                    \
    {                             \
        if (access(x, F_OK) != 0) \
        {                         \
            printf("%s\n", x);    \
            assert(0);            \
        }                         \
    }

typedef struct BoxInfo
{
    float x1;
    float y1;
    float x2;
    float y2;
    float score;
    int label;

    BoxInfo(float x1, float y1, float x2, float y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}

} BoxInfo;

struct Output
{
    int id;           //结果类别id
    float confidence; //结果置信度
    cv::Rect box;     //矩形框

    Json::Value toJson(string name)
    {
        Json::Value jTmpValue;
        jTmpValue["x"] = int(box.x);
        jTmpValue["y"] = int(box.y);
        jTmpValue["width"] = int(box.width);
        jTmpValue["height"] = int(box.height);
        jTmpValue["name"] = name;
        jTmpValue["confidence"] = confidence;
        return jTmpValue;
    }
};
struct Outputf
{
    float id;           //结果类别id
    float confidence; //结果置信度
    cv::Rect box;     //矩形框
};
void split(std::vector<std::string> &strings, std::string data);

#endif